export function setItem (key, value) { // value如果是字符串则不需要调用JSON.stringfy
  if (typeof value !== 'string') {
    value = JSON.stringify(value)
  }
  localStorage.setItem(key, value)
}
export function getItem (key) {
  try {
    const value = localStorage.getItem(key)
    return value ? JSON.parse(value) : null
  } catch (error) {
    return null
  }
}
